package com.senlingspace.payment.enums;

/**
 * 抖音验券类型
 *
 * @author lebronjames
 * @date 2024/07/24
 */
public enum DouyinVerifyTypeEnum {

    USER(1, "用户自验券"),

    MERCHANT_QRCODE(2, "商家扫二维码验券"),

    MERCHANT_CODE(3, "商家手动输入券码验券"),

    OPENAPI(4, "通过开放平台API验券"),

    LIFE(5, "抖音来客app核销"),

    AUTO(7, "自动核销"),

    UNKNOWN(0, "未知验券类型");

    private final int code;
    private final String desc;

    DouyinVerifyTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static DouyinVerifyTypeEnum getVerifyType(int code) {
        for (DouyinVerifyTypeEnum verifyTypeEnum : DouyinVerifyTypeEnum.values()) {
            if (verifyTypeEnum.getCode() == code) {
                return verifyTypeEnum;
            }
        }
        return UNKNOWN;
    }

}
